class Student:
    count = 0 # 计数
    school1 = "上学" # 类属性
    def __init__(self,name,age,sex,cname):
        self.name = name
        self.age = age
        self.sex = sex
        self.cname = cname
        # print(f"大家好，我叫做{self.name}，今年{self.age}岁，性别为：{self.sex},班级是：{self.cname}")
        # self.count+=1  # 对象+1，这是错误的
        Student.count+=1 # 要用类的名称，调用类属性
        # 统计多少个学生
    def eat(self,food):
        print(f"{self.name}正在吃{food}")
    def show_info(self):
        print(f"大家好，我叫做{self.name}，今年{self.age}岁，性别为：{self.sex},班级是：{self.cname}")
    def school(self): # 函数/方法/类方法
        print(f"{self.name}在上学")



if __name__ == '__main__':
    s1 = Student("王俊博",20,"中性","23期")
    s2 = Student("赵俊博",19,"女","22期")
    s1.address = "吉林" # 给对象增加实例属性
    # print(s1.address)
    # print(s1) # 直接打印是地址值
    # print(s2.address) # 没定义就找不到
    # del s1
    # s1.show_info()
    # s1.eat("饿了白哥，吃啥都行")
    # print(Student.count) #2
    # 方法：类和对象分别调用的地址值，不一样
    """print(id(s1.school))
    print(id(Student.school))"""
    # 类属性：类和对象分别调用的地址值，一样
    print(id(s1.school1))
    print(id(Student.school1))


    # __dict__，打印类 / 实例对象的所有属性


